import path from "path";
import ts from "rollup-plugin-typescript2";
import dts from "rollup-plugin-dts";
// import commonjs from "rollup-plugin-commonjs";
const __dirname = path.resolve();

export default [
  {
    input: "./src/core/index.ts",
    output: [
      {
        file: path.resolve(__dirname, "./dist/index.esm.js"),
        format: "es", /// 输出的类型
      },
      {
        file: path.resolve(__dirname, "./dist/index.cjs.js"),
        format: "cjs", /// 输出的类型
      },
      {
        file: path.resolve(__dirname, "./dist/index.js"),
        format: "umd", //
        name: "tracker", /// umd 模式必须要有 name
      },
    ],
    plugins: [ts()],
  },
  {
    input: "./src/core/index.ts",
    output: {
      file: path.resolve(__dirname, "./dist/index.d.js"),
      format: "es", //
    },
    plugins: [dts()],
  },
];
